<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="{$_C.hy_path}css/hy.admin.css"/>
	</head>
	<body>
	<div class="am-g">
		 {include file='../Common/hy_header.html'}
		 <div class="am-g">
			<br>
			
			<div class="am-u-md-8 am-u-end">
				<form class="am-form am-form-horizontal hy-js-form">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">活动名称</label>
						<div class="am-u-sm-6">
							<input type="text" name="act_name" value="" placeholder="最多16个字">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">祝福语</label>
						<div class="am-u-sm-6">
							<input type="text" name="wishing" value="" placeholder="最多16个字">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">总金额(元)</label>
						<div class="am-u-sm-6">
							<input type="text" name="total_amount" value="" placeholder="最低金额0.01">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">红包发放总人数</label>
						<div class="am-u-sm-6">
							<input type="text" name="total_num" value="" placeholder="普通该值必须为等于1，裂变该值须大于1小于20">
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">红包类型</label>
						<div class="am-u-sm-6" style="float: left;">
								<input type="radio" value="2" checked="checked"  name='hb_type'> 普通
								<input type="radio" value="1" name="hb_type"> 裂变
						</div>
						<div class="am-u-sm-3">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">批量生成红包数</label>
						<div class="am-u-sm-6" style="float: left;">
								<input type="text" id="number" name="number" value="1" placeholder="">
						</div>
						<div class="am-u-sm-3">
							批量生成时，如果成功，请耐心其等候自行关闭页面
						</div>
					</div>
					
					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<input type="hidden" name="lid" value="{$id}">
							<button type="button" class="am-btn am-btn-primary hy-js-submit">红包预下单</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	  {include file='../Common/hy_footer.html'}
	<script type="text/javascript" src="{$_C.hy_path}js/editor/kindeditor.js"></script>
	<script type="text/javascript" src="{$_C.hy_path}js/laydate/laydate.js"></script>
	<script type="text/javascript">
		var time = 0 ;
	    hy_submit('index.php?g=admin&m=chat&a=insert_hongbao','',function(result){
			if(result.error==1){
				showMsg(result.content,result.error);
			}else{
				time++;
				showMsg(result.content,result.error);
				if($("#number").val()>1){
					if(time<$("#number").val()){
						$(".hy-js-submit").click();
					}else{
						parent.$('#luckyDraw').attr('src', parent.$('#luckyDraw').attr('src'));
						parent.$('#hongbao_{$id}').attr('src', parent.$('#hongbao_{$id}').attr('src'));
						var tab_li = parent.$(".am-active");
					if(tab_li.prev().length>0)
					{
						tab_li.prev().addClass('am-active');
						var id=tab_li.prev().attr('data-id');
				        parent.$('#'+id).show();
					}
					else if(tab_li.next().length>0)
					{
						tab_li.next().addClass('am-active');
						var id=tab_li.next().attr('data-id');
						console.info("next:"+id);
				        parent.$('#'+id).show();
					}
					else
					{
						var tab='<li data-id="index" class="am-active"><a  href="javascript:;"><span class="hy-tabs-title">首页</span><span class="am-icon-close"></span></a></li>'
					    parent.$('.hy-tabs .am-nav').append(tab);
					    var iframe='<iframe onload="javascript:hy_loading()" id="index" src="index.php?g=admin&m=index&a=main" width="100%" height="100%"></iframe>';
					    parent.$('.hy-iframe').append(iframe);
					}
					var id=tab_li.attr('data-id');
					tab_li.remove();
					parent.$('#'+id).remove();
					}
				}else{
					parent.$('#luckyDraw').attr('src', parent.$('#luckyDraw').attr('src'));
					parent.$('#hongbao_{$id}').attr('src', parent.$('#hongbao_{$id}').attr('src'));
					var tab_li = parent.$(".am-active");
					if(tab_li.prev().length>0)
					{
						tab_li.prev().addClass('am-active');
						var id=tab_li.prev().attr('data-id');
				        parent.$('#'+id).show();
					}
					else if(tab_li.next().length>0)
					{
						tab_li.next().addClass('am-active');
						var id=tab_li.next().attr('data-id');
						console.info("next:"+id);
				        parent.$('#'+id).show();
					}
					else
					{
						var tab='<li data-id="index" class="am-active"><a  href="javascript:;"><span class="hy-tabs-title">首页</span><span class="am-icon-close"></span></a></li>'
					    parent.$('.hy-tabs .am-nav').append(tab);
					    var iframe='<iframe onload="javascript:hy_loading()" id="index" src="index.php?g=admin&m=index&a=main" width="100%" height="100%"></iframe>';
					    parent.$('.hy-iframe').append(iframe);
					}
					var id=tab_li.attr('data-id');
					tab_li.remove();
					parent.$('#'+id).remove();
					
				}
			}
			
		});
	</script>
	</body>
</html>
